package com.netease.pris.a;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class p
{
  public static final int a = 256;
  public static final int b = 256;
  public static final float c = 1.1F;

  public static int a(Context paramContext, float paramFloat)
  {
    return (int)(0.5F + paramFloat * paramContext.getResources().getDisplayMetrics().density);
  }

  // ERROR //
  public static Bitmap a(Context paramContext, android.net.Uri paramUri, int paramInt1, int paramInt2)
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnonnull +9 -> 10
    //   4: aconst_null
    //   5: astore 5
    //   7: aload 5
    //   9: areturn
    //   10: aload_0
    //   11: invokevirtual 43	android/content/Context:getContentResolver	()Landroid/content/ContentResolver;
    //   14: aload_1
    //   15: invokevirtual 49	android/content/ContentResolver:openInputStream	(Landroid/net/Uri;)Ljava/io/InputStream;
    //   18: astore 6
    //   20: new 51	android/graphics/BitmapFactory$Options
    //   23: dup
    //   24: invokespecial 52	android/graphics/BitmapFactory$Options:<init>	()V
    //   27: astore 7
    //   29: aload 7
    //   31: iconst_1
    //   32: putfield 56	android/graphics/BitmapFactory$Options:inJustDecodeBounds	Z
    //   35: aload 6
    //   37: aconst_null
    //   38: aload 7
    //   40: invokestatic 62	android/graphics/BitmapFactory:decodeStream	(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    //   43: pop
    //   44: aload 7
    //   46: iconst_0
    //   47: putfield 56	android/graphics/BitmapFactory$Options:inJustDecodeBounds	Z
    //   50: aload 6
    //   52: invokevirtual 67	java/io/InputStream:close	()V
    //   55: aload 7
    //   57: getfield 70	android/graphics/BitmapFactory$Options:outWidth	I
    //   60: i2f
    //   61: iload_2
    //   62: i2f
    //   63: fdiv
    //   64: fstore 10
    //   66: aload 7
    //   68: getfield 73	android/graphics/BitmapFactory$Options:outHeight	I
    //   71: i2f
    //   72: iload_3
    //   73: i2f
    //   74: fdiv
    //   75: fstore 11
    //   77: aload 7
    //   79: iconst_1
    //   80: putfield 76	android/graphics/BitmapFactory$Options:inSampleSize	I
    //   83: fload 10
    //   85: fconst_1
    //   86: fcmpl
    //   87: ifgt +10 -> 97
    //   90: fload 11
    //   92: fconst_1
    //   93: fcmpl
    //   94: ifle +22 -> 116
    //   97: fload 10
    //   99: fload 11
    //   101: fcmpl
    //   102: ifle +75 -> 177
    //   105: aload 7
    //   107: fload 10
    //   109: ldc 77
    //   111: fadd
    //   112: f2i
    //   113: putfield 76	android/graphics/BitmapFactory$Options:inSampleSize	I
    //   116: aload_0
    //   117: invokevirtual 43	android/content/Context:getContentResolver	()Landroid/content/ContentResolver;
    //   120: aload_1
    //   121: invokevirtual 49	android/content/ContentResolver:openInputStream	(Landroid/net/Uri;)Ljava/io/InputStream;
    //   124: astore 13
    //   126: aload 13
    //   128: aconst_null
    //   129: aload 7
    //   131: invokestatic 62	android/graphics/BitmapFactory:decodeStream	(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    //   134: astore 5
    //   136: aload 13
    //   138: invokevirtual 67	java/io/InputStream:close	()V
    //   141: goto -134 -> 7
    //   144: astore 14
    //   146: aload 14
    //   148: invokevirtual 80	java/io/IOException:printStackTrace	()V
    //   151: goto -144 -> 7
    //   154: astore 4
    //   156: aload 4
    //   158: invokevirtual 81	java/io/FileNotFoundException:printStackTrace	()V
    //   161: aconst_null
    //   162: astore 5
    //   164: goto -157 -> 7
    //   167: astore 9
    //   169: aload 9
    //   171: invokevirtual 80	java/io/IOException:printStackTrace	()V
    //   174: goto -119 -> 55
    //   177: fload 11
    //   179: fstore 10
    //   181: goto -76 -> 105
    //   184: astore 12
    //   186: aload 12
    //   188: invokevirtual 81	java/io/FileNotFoundException:printStackTrace	()V
    //   191: aconst_null
    //   192: astore 5
    //   194: goto -187 -> 7
    //
    // Exception table:
    //   from	to	target	type
    //   136	141	144	java/io/IOException
    //   10	20	154	java/io/FileNotFoundException
    //   50	55	167	java/io/IOException
    //   116	126	184	java/io/FileNotFoundException
  }

  public static Bitmap a(Bitmap paramBitmap)
  {
    int i = paramBitmap.getWidth();
    int j = paramBitmap.getHeight();
    Bitmap localBitmap = Bitmap.createBitmap(i, j, Bitmap.Config.ARGB_8888);
    Canvas localCanvas = new Canvas(localBitmap);
    Paint localPaint = new Paint();
    Rect localRect = new Rect(0, 0, i, j);
    RectF localRectF = new RectF(localRect);
    localPaint.setAntiAlias(true);
    localCanvas.drawARGB(0, 0, 0, 0);
    localPaint.setColor(-12434878);
    localCanvas.drawRoundRect(localRectF, 5.0F, 5.0F, localPaint);
    localPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    localCanvas.drawBitmap(paramBitmap, localRect, localRect, localPaint);
    return localBitmap;
  }

  public static final Bitmap a(Bitmap paramBitmap, float paramFloat1, float paramFloat2)
  {
    Matrix localMatrix = new Matrix();
    int i = paramBitmap.getWidth();
    int j = paramBitmap.getHeight();
    float f1 = i / paramFloat1;
    float f2 = j / paramFloat2;
    int m;
    int k;
    if (f1 > f2)
    {
      m = (int)paramFloat1;
      k = (int)(j / f1);
    }
    while (true)
    {
      localMatrix.setScale(1.0F, 1.0F);
      Bitmap localBitmap = Bitmap.createScaledBitmap(paramBitmap, m, k, false);
      paramBitmap.recycle();
      return localBitmap;
      k = (int)paramFloat2;
      m = (int)(i / f2);
    }
  }

  static Bitmap a(Bitmap paramBitmap, int paramInt)
  {
    Matrix localMatrix;
    if ((paramInt != 0) && (paramBitmap != null))
    {
      localMatrix = new Matrix();
      localMatrix.setRotate(paramInt, paramBitmap.getWidth() / 2.0F, paramBitmap.getHeight() / 2.0F);
    }
    try
    {
      int i = paramBitmap.getWidth();
      int j = paramBitmap.getHeight();
      Bitmap localBitmap = Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, true);
      if (paramBitmap != localBitmap)
      {
        paramBitmap.recycle();
        paramBitmap = localBitmap;
      }
      return paramBitmap;
    }
    catch (OutOfMemoryError localOutOfMemoryError)
    {
      while (true)
        localOutOfMemoryError.printStackTrace();
    }
  }

  public static Bitmap a(Bitmap paramBitmap, int paramInt1, int paramInt2)
  {
    if (paramBitmap == null)
      paramBitmap = null;
    int i;
    int j;
    float f1;
    float f2;
    do
    {
      return paramBitmap;
      i = paramBitmap.getWidth();
      j = paramBitmap.getHeight();
      f1 = paramInt1 / i;
      f2 = paramInt2 / j;
    }
    while ((f1 >= 1.0F) && (f2 >= 1.0F));
    if (f1 < f2);
    while (true)
    {
      Matrix localMatrix = new Matrix();
      localMatrix.postScale(f1, f1);
      Bitmap localBitmap = Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, true);
      paramBitmap.recycle();
      paramBitmap = localBitmap;
      break;
      f1 = f2;
    }
  }

  public static Bitmap a(Drawable paramDrawable)
  {
    int i = paramDrawable.getIntrinsicWidth();
    int j = paramDrawable.getIntrinsicHeight();
    if (paramDrawable.getOpacity() != -1);
    for (Bitmap.Config localConfig = Bitmap.Config.ARGB_8888; ; localConfig = Bitmap.Config.RGB_565)
    {
      Bitmap localBitmap = Bitmap.createBitmap(i, j, localConfig);
      Canvas localCanvas = new Canvas(localBitmap);
      paramDrawable.setBounds(0, 0, i, j);
      paramDrawable.draw(localCanvas);
      return localBitmap;
    }
  }

  public static Bitmap a(String paramString)
  {
    Object localObject = null;
    try
    {
      Bitmap localBitmap = BitmapFactory.decodeFile(paramString);
      localObject = localBitmap;
      return localObject;
    }
    catch (OutOfMemoryError localOutOfMemoryError)
    {
      while (true)
      {
        localOutOfMemoryError.printStackTrace();
        if (0 != 0)
          null.recycle();
        System.gc();
      }
    }
  }

  public static Bitmap a(String paramString, int paramInt1, int paramInt2)
  {
    Object localObject = null;
    if (paramString == null);
    while (true)
    {
      return localObject;
      BitmapFactory.Options localOptions = new BitmapFactory.Options();
      localOptions.inJustDecodeBounds = true;
      Bitmap localBitmap1 = BitmapFactory.decodeFile(paramString, localOptions);
      localOptions.inJustDecodeBounds = false;
      float f1 = localOptions.outWidth / paramInt1;
      float f2 = localOptions.outHeight / paramInt2;
      localOptions.inSampleSize = 1;
      if ((f1 > 1.0F) || (f2 > 1.0F))
      {
        if (f1 <= f2)
          break label113;
        localOptions.inSampleSize = (int)f1;
      }
      try
      {
        Bitmap localBitmap3 = BitmapFactory.decodeFile(paramString, localOptions);
        localBitmap2 = localBitmap3;
        localObject = localBitmap2;
        continue;
        label113: f1 = f2;
      }
      catch (OutOfMemoryError localOutOfMemoryError)
      {
        while (true)
        {
          localOutOfMemoryError.printStackTrace();
          if (localBitmap1 != null)
            localBitmap1.recycle();
          localOptions.requestCancelDecode();
          Bitmap localBitmap2 = null;
          System.gc();
        }
      }
    }
  }

  public static Drawable a(Drawable paramDrawable, int paramInt1, int paramInt2)
  {
    int i = paramDrawable.getIntrinsicWidth();
    int j = paramDrawable.getIntrinsicHeight();
    Bitmap localBitmap = a(paramDrawable);
    Matrix localMatrix = new Matrix();
    localMatrix.postScale(paramInt1 / i, paramInt2 / j);
    return new BitmapDrawable(Bitmap.createBitmap(localBitmap, 0, 0, i, j, localMatrix, true));
  }

  public static boolean a(Bitmap paramBitmap, int paramInt, File paramFile, Bitmap.CompressFormat paramCompressFormat)
  {
    try
    {
      FileOutputStream localFileOutputStream = new FileOutputStream(paramFile);
      bool = paramBitmap.compress(paramCompressFormat, paramInt, localFileOutputStream);
      return bool;
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      while (true)
      {
        localFileNotFoundException.printStackTrace();
        boolean bool = false;
      }
    }
  }

  public static boolean a(Bitmap paramBitmap, int paramInt, String paramString, Bitmap.CompressFormat paramCompressFormat)
  {
    return a(paramBitmap, paramInt, new File(paramString), paramCompressFormat);
  }

  public static int b(Context paramContext, float paramFloat)
  {
    return (int)(0.5F + paramFloat / paramContext.getResources().getDisplayMetrics().density);
  }

  public static Bitmap b(Bitmap paramBitmap, int paramInt1, int paramInt2)
  {
    Object localObject = null;
    if (paramBitmap == null);
    while (true)
    {
      return localObject;
      if ((paramInt1 <= 0) || (paramInt2 <= 0))
      {
        localObject = paramBitmap;
        continue;
      }
      Matrix localMatrix = new Matrix();
      float f1 = paramBitmap.getWidth() / paramInt1;
      float f2 = paramBitmap.getHeight() / paramInt2;
      int i;
      int j;
      int k;
      int m;
      if (f1 < f2)
      {
        i = (int)(f1 * paramInt1);
        j = (int)(f1 * paramInt2);
        if (i > paramBitmap.getWidth())
          i = paramBitmap.getWidth();
        if (j > paramBitmap.getHeight())
          j = paramBitmap.getHeight();
        localMatrix.setScale(1.0F / f1, 1.0F / f1);
        k = paramBitmap.getWidth() - i >> 1;
        m = paramBitmap.getHeight() / 3 - j / 2;
        if (m < 0)
          m = 0;
      }
      try
      {
        System.currentTimeMillis();
        Bitmap localBitmap2 = Bitmap.createBitmap(paramBitmap, k, m, i, j, localMatrix, true);
        localBitmap1 = localBitmap2;
        localObject = localBitmap1;
        continue;
        f1 = f2;
      }
      catch (OutOfMemoryError localOutOfMemoryError)
      {
        while (true)
        {
          localOutOfMemoryError.printStackTrace();
          if (0 != 0)
            null.recycle();
          Bitmap localBitmap1 = null;
          System.gc();
        }
      }
    }
  }

  public static Bitmap b(String paramString, int paramInt1, int paramInt2)
  {
    Object localObject = null;
    if (paramString == null);
    while (true)
    {
      return localObject;
      BitmapFactory.Options localOptions = new BitmapFactory.Options();
      localOptions.inJustDecodeBounds = true;
      Bitmap localBitmap1 = BitmapFactory.decodeFile(paramString, localOptions);
      localOptions.inJustDecodeBounds = false;
      float f1 = localOptions.outWidth / paramInt1;
      float f2 = localOptions.outHeight / paramInt2;
      localOptions.inSampleSize = 1;
      if ((f1 > 1.0F) || (f2 > 1.0F))
      {
        if (f1 <= f2)
          break label116;
        localOptions.inSampleSize = (int)(f1 + 0.9F);
      }
      try
      {
        Bitmap localBitmap3 = BitmapFactory.decodeFile(paramString, localOptions);
        localBitmap2 = localBitmap3;
        localObject = localBitmap2;
        continue;
        label116: f1 = f2;
      }
      catch (OutOfMemoryError localOutOfMemoryError)
      {
        while (true)
        {
          localOutOfMemoryError.printStackTrace();
          if (localBitmap1 != null)
            localBitmap1.recycle();
          localOptions.requestCancelDecode();
          Bitmap localBitmap2 = null;
          System.gc();
        }
      }
    }
  }

  public static Bitmap c(String paramString, int paramInt1, int paramInt2)
  {
    Bitmap localBitmap1 = null;
    if (paramString == null);
    while (true)
    {
      return localBitmap1;
      try
      {
        Bitmap localBitmap2 = BitmapFactory.decodeFile(paramString);
        localBitmap1 = b(localBitmap2, paramInt1, paramInt2);
        if (localBitmap2 == null)
          continue;
        localBitmap2.recycle();
      }
      catch (NullPointerException localNullPointerException)
      {
        localNullPointerException.printStackTrace();
      }
      if (0 == 0)
        continue;
      null.recycle();
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.a.p
 * JD-Core Version:    0.6.0
 */